package com.boscloud.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.boscloud.pojo.*;
import com.boscloud.service.GetLocationCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin //允许跨域
@RestController

public class GetLocationCheckController {
    @Autowired
    private GetLocationCheckService GetLocationCheckService;
    @PostMapping("/GetLocationCheck")//PDA盘点条码信息
    public List<GetLocationCheck> getGetLocationCheckList(@RequestBody Map<String, Object> params) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID", "ITMS023");//接口ID
        return GetLocationCheckService.getGetLocationCheckList(params, headers);
    }
    @PostMapping("/PostLocationCheck")//盘点保存
    public List<GetLocationCheck> PostLocationCheckList(@RequestBody GetLocationCheck GetLocationCheck) throws IOException {
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("PORTID","ITMS024");//接口ID
        Map<String, Object> params  = JSONObject.parseObject(JSON.toJSONString(GetLocationCheck));
        return GetLocationCheckService.PostLocationCheckList(params,headers);
    }
}
